<template>
    <div>
        <header class="padding_tb20 pr white">
            <img src="../../assets/images/7.jpg" class="displayB centerauto shadowB" style="max-width: 70%;margin: 15px auto 17px;padding: 10px;background: #fff;" />
            <p class="text-center bolds account_name colorO">{{infoData.u_email}}</p>
            <div class="flexbox spacebetween padding_lr15 margin_t15">
                <p>我的邀请码：<span class="colorO">{{infoData.u_code}}</span></p>
                <p>美金余额：<span class="colorO bolds">{{infoData.u_dollar_balance}}</span></p>
            </div>
        </header>
        <p class="wen_bg"></p>
        <van-cell-group>
            <van-cell title="账户设置" is-link to="/accountinfo" />
            <van-cell title="转账" is-link to="/transfer" />
            <van-cell title="转账记录" is-link to="/transferrecord" />
            <van-cell title="充值" is-link to="/recharge" />
            <van-cell title="充值记录" is-link to="/rechargerecord" />
            <van-cell title="提现" is-link :to="{path: '/cash',query: {'harge': infoData.harge}}" />
            <van-cell title="提现记录" is-link to="/cashrecord" />
            <van-cell title="设置密码" is-link :to="{path: '/passwordmanage',query: {'set': infoData.u_cash_transfer_password}}" />
            <van-cell title="证券提现" is-link to="/transformation" />
            <van-cell title="推广管理" is-link to="/extension" />
        </van-cell-group>
        <div class="text-center margin_tb30">
            <van-button type="primary" class="width_80p btn_size_40" @click="loginout">退出登录</van-button>
        </div>
    </div>
</template>
<script>

    import '@/assets/css/main.css'
    export default {
        data(){
            return{
                infoData: {},
            }
        },
        methods: {
            init(){
                document.title = '个人中心';
                var _this = this;

                this.$httpGet('/api/index/Personal_center/getuserinfobyuid',{
                    'u_id': window.localStorage.u_id,
                }).then(response => {
                    
                    if(response.code == 200){
                        
                        _this.infoData = response.msg;

                    }else{
                        _this.$toast(response.msg);
                    }

                })
            },
            loginout(){
                var _this = this;

                this.$dialog.alert({
                    message: '确认退出登录吗？',
                    showCancelButton: true
                }).then(() => {
                    //退出
                    window.localStorage.clear();
                    _this.$toast('已退出');
                    setTimeout(() => {
                        _this.$router.push({path: '/login'});
                    }, 2000);
                }).catch(() => {
                    // on cancel
                });
                
            },
        },
        mounted(){
            this.init();
        },
        destroyed(){
            document.title = 'Dukascopy';
        },
    }
</script>